<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <script src="https://cdn.bootcdn.net/ajax/libs/jquery/3.5.1/jquery.js"></script>
    <style>
        a,
        ul,
        li {
            list-style: none;
            text-decoration: none;
            margin: 0;
            padding: 0;
        }

        .wrap {
            width: 600px;
            height: 400px;
            margin: 100px auto;
            position: relative;
            overflow: hidden;
        }

        .navs {
            width: 4200px;
            height: 100%;
            position: absolute;
            top: 0;
            left: -600px;
            /* border: 1px solid red; */
        }

        .navs li {
            width: 600px;
            height: 100%;
            float: left;
        }

        .navs li img {
            width: 100%;
            height: 100%;
        }

        #bots {
            display: inline-block;
            width: 600px;
            height: 40px;
            background: rgba(0, 0, 0, .3);
            text-align: center;
            position: absolute;
            bottom: 0;
            left: 0;
        }

        #bots li {
            width: 20px;
            height: 20px;
            border-radius: 50%;
            background: #cccccc;
            position: relative;
            left: 220px;
            top: 10px;
            margin-left: 10px;
            float: left;
        }

        #bots .active {
            background: red;
        }
    </style>
</head>

<body>
    <div class="wrap" id="box">
        <ul id='navs' class="navs">
            <li><a href="javascript:;"><img src="./ban5.jpg" /></a></li>
            <li><a href="javascript:;"><img src="./ban1.jpg" /></a></li>
            <li><a href="javascript:;"><img src="./ban2.jpg" /></a></li>
            <li><a href="javascript:;"><img src="./ban3.jpg" /></a></li>
            <li><a href="javascript:;"><img src="./ban4.jpg" /></a></li>
            <li><a href="javascript:;"><img src="./ban5.jpg" /></a></li>
            <li><a href="javascript:;"><img src="./ban1.jpg" /></a></li>
        </ul>
        <ul id="bots">
            <li class="bot active"></li>
            <li class="bot"></li>
            <li class="bot"></li>
            <li class="bot"></li>
            <li class="bot"></li>
        </ul>
    </div>

    <script>
        let timer = null;
        let num = 1;
        let i = 0;
        function swiper() {
            timer = setInterval(()=>{
                    num++;
                    if (num > 6) {
                        $("#navs").css('left', -600)
                        num = 2;
                    } 
                    $("#navs").animate({ left: -num * 600 }, 500); 
                    i++;
                    if (i > 4) {
                        i = 0;
                    }
                    $("#bots li").eq(i).addClass('active').siblings().removeClass('active');
            }, 1000);
        }

        $("#navs").mouseout(()=>{
            clearInterval(timer);
        });

        $("#navs").mouseover(()=>{
            swiper();
        });

    </script>
</body>

</html>